package com.jrx.anytxn.transaction.job.paph.step;

import com.jrx.anytxn.param.entity.PrOrganizationTable;
import com.jrx.anytxn.transaction.constant.TransBizConstant;
import com.jrx.anytxn.transaction.entity.TlDisbursementLog;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.batch.MyBatisPagingItemReader;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class TraAcctDetailFileReader extends MyBatisPagingItemReader<TlDisbursementLog> {

    public TraAcctDetailFileReader(SqlSessionFactory sqlSessionFactory, PrOrganizationTable org, Integer pagesize) {
        setSaveState(false);
        setPageSize(pagesize);
        setSqlSessionFactory(sqlSessionFactory);
        setQueryId("com.jrx.anytxn.transaction.mapper.ext.ExtTlDisbursementLogMapper.selectByBatch");
        Map<String, Object> map = new HashMap<>();
        map.put("channel", TransBizConstant.PAPH_CHANNEL);
        map.put("sumStatus", Arrays.asList(TransBizConstant.PAYMENT_LOG_SUM_STATUS_S, TransBizConstant.PAYMENT_LOG_SUM_STATUS_F));
        map.put("collateDate", org.getToday());
        setParameterValues(map);
    }

}
